#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#include<fstream>
#include<cmath>
using namespace std;
long long x,n,l,r;
int main(){
	freopen("candy.in","r",stdin);
	freopen("candy.out","w",stdout);
	cin>>n>>l>>r;
	x=l/n;
	cout<<min(r-x*n,n-1);
	return 0;
}
